package 临时工具.其他;

import java.math.BigInteger;

public class BigFactorialLoop {
    public static BigInteger factorial(int n) {
        BigInteger result = BigInteger.ONE;

        for (int i = 2; i <= n; i++) {
            result = result.multiply(BigInteger.valueOf(i));
        }

        return result;
    }

    public static void main(String[] args) {
        int number = 1000;
        BigInteger result = factorial(number);

        System.out.println(number + "! =");
        System.out.println(result);
    }
}
